package cn.bgs.controller;

import cn.bgs.pojo.Dept;
import cn.bgs.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/dept")
public class DeptController {

    @Autowired
    private DeptService deptService;
//1111
//222
    //查询10部门Dept表的所有信息包括员工的信息
    @RequestMapping("/findByIdDept")
    public String findByIdDept(Model m){

        Integer id = 10;
        Dept de = deptService.findByIdDept(id);

        m.addAttribute("de",de);

        return "show2";
    }

   /* //查询10部门Dept表的所有信息包括员工的信息
    @RequestMapping("/findByIdDept")
    @ResponseBody
    public Dept findByIdDept(){

        Integer id = 10;

        return deptService.findByIdDept(id);
    }*/

    //查询10部门Dept表的所有信息包括员工的信息(一对多分步)
    @RequestMapping("/findByIdDeptfenbu")
    @ResponseBody
    public Dept findByIdDeptfenbu(){

        Integer id = 10;

        return deptService.findByIdDeptfenbu(id);
    }

}
